﻿using Helper;
using SampleLiteDb.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SampleLiteDb
{
    internal class Program
    {
        static void Main(string[] args)
        {
            // print line 
            Console.WriteLine("Sample LiteDb");

            var helper = new LiteDbHelper("sample.db");


            var col = helper.GetCollection<AppConfig>("appconfig");



            col.EnsureIndex(x => x.UiqKey);

            col.Insert(new AppConfig());

            var ret = col.Query();
            Console.WriteLine(ret.Count());
            Console.ReadKey();

            foreach (var item in ret.ToList()) {
                Console.WriteLine($"{item.ObjItem?.UiqKey }  " + item.UiqKey);
            }

            Console.ReadKey();


            // pause console 

        }
    }
}
